@using BootstrapSupport
@model System.Collections.IEnumerable   
    <h4>@Model.GetLabel() <small>Listing</small></h4>
<table class="table table-striped">
    <caption></caption>
    <thead>
        <tr>
            @foreach (var property in Model.VisibleProperties())
            {
                <th>
                    @property.GetLabel().ToSeparatedWords()
                </th>
            }
            <th></th>
        </tr>
    </thead>
    @{ int index = 0; }
    @foreach (var model in Model)
    {
        ViewData[index.ToString()] = model;
        <tr>
            @foreach (var property in model.VisibleProperties())
            {
                <td>
                    @Html.Display(index + "." + property.Name)
                </td>                    
            }
            <td>
                <div class="btn-group">
                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                        Action
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        @{
                            @Html.TryPartial("_actions", model)                            
                            var routevalues = model.GetIdValue();  
                            <li>@Html.ActionLink("Edit", "Edit", routevalues)</li>
                            <li>@Html.ActionLink("Details", "Details", routevalues)</li>
                            <li class="divider"></li>
                            <li>@Html.ActionLink("Delete", "Delete", routevalues)</li>
                               
                        }
                    </ul>
                </div>

            </td>
        </tr>
            index++;
    }

</table>
<p>
    @Html.ActionLink("Create New", "Create", null, new {@class = "btn"})
</p>

